package com.csdnn;

import java.sql.SQLOutput;

public class Test2 {
    public static void main(String[] args) {
        BoyFriend BF=BoyFriend.getInstance();
        System.out.println(BF);
    }
}

class BoyFriend{
    private String name;
    private static BoyFriend bf;
    private BoyFriend(String name){
        this.name=name;
    }
    public static BoyFriend getInstance(){
        if(bf==null){
            bf=new BoyFriend("至尊宝");
        }
        return bf;
    }

    @Override
    public String toString() {
        return "BoyFriend{" +
                "name='" + name + '\'' +
                '}';
    }
}